﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections.Specialized;
using PUCIT.eFCS.Utility.Encryption;
using System.Web.Configuration;

namespace PUCIT.eFCS
{
    public partial class ViewTemplateList : System.Web.UI.Page
    {
        protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            HyperLink link1 = (HyperLink)e.Row.FindControl("HyperLink1");
            HyperLink link2 = (HyperLink)e.Row.FindControl("HyperLink2");


            if (link1 != null && link2 != null) // If its not the first row (headers of grid view)
            {
                NameValueCollection queryStringParameters = new NameValueCollection();
                queryStringParameters.Add("documentId", e.Row.Cells[0].Text);

                // Encrypt query string parameters
                string encryptedString = CryptoQueryStringHandler.EncryptQueryStrings(queryStringParameters, WebConfigurationManager.AppSettings["CryptoKey"]);

                link1.NavigateUrl = "~/ViewFormTemplate.aspx?" + encryptedString;
                //link2.NavigateUrl = "~/UpdateFormTemplate.aspx?" + encryptedString;
                link2.NavigateUrl = "~/DesignStationSections.aspx?" + encryptedString;
            }
        }
    }
}